package com.cloudptt.wp.ui.more;
//Download by htp://www.codefans.net


import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.text.method.ScrollingMovementMethod;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.cloudptt.api.comm.CommInfo;
import com.cloudptt.api.models.VersionInfo;
import com.cloudptt.api.product.Product;
import com.cloudptt.api.product.log.Log;
import com.cloudptt.wp.R;
import com.cloudptt.wp.ScreenManager;
import com.cloudptt.wp.SysApplication;
import com.cloudptt.wp.ui.BaseActivity;
import com.mcptt.config.local.SysConfig;
import com.mcptt.config.model.McIdInfo;
import com.mcptt.config.model.ServerInfo;

import java.io.File;

public class VoiceActivity extends BaseActivity implements OnClickListener {
	
	private TextView returnBtn;
	private SysConfig sysConfig = null;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Window window = getWindow();
//		window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
		//window.setStatusBarColor(getResources().getColor(R.color.app_theme_color_primary));
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sysinfo);
		
//		getActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.app_theme_color_primary));
//		getActionBar().hide();

		
		TextView infoTv = (TextView)findViewById(R.id.infoTv);
//		infoTv.setMovementMethod(ScrollingMovementMethod.getInstance());

		SysApplication app = ((SysApplication) getApplicationContext());
		Product product = app.getProduct();
		this.sysConfig = product.getSysConfig();
		float txLevel = this.sysConfig.getTxLevel();
		float rxLevel = this.sysConfig.getRxLevel();
		if(txLevel > 1.99)
		{
			txLevel = (float)1.99;
		}
		if(rxLevel > 1.99)
		{
			rxLevel = (float)1.99;
		}
		boolean isShow = this.sysConfig.isShowApp();
		infoTv.setText("TX:" + txLevel + "    RX:" + rxLevel + "    isShow:" + isShow);

		TextView tv = (TextView) findViewById(R.id.titleTv);
		tv.setText(R.string.settings_call);

		ScreenManager.getScreenManager().pushActivity(this);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		
		if(android.R.id.home == item.getItemId()){
			finish();
			return true;
		}
		
		return super.onOptionsItemSelected(item);
	}
	
	public void onClick(View v) {
//		int id = v.getId();
//		if(id == R.id.back_up_icon)
//		{
//
//		}
	}
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		Log.debug(SysInfoActivity.class, "onKeyDown keyCode " + keyCode);
//		if (keyCode == KeyEvent.KEYCODE_SOFT_LEFT
//				|| keyCode == 66)
//		{
//			SysApplication app = ((SysApplication) getApplicationContext());
//			Product product = app.getProduct();
//			product.beginUpload(SysInfoActivity.this,null);
//			return false;
//		}

		return super.onKeyDown(keyCode, event);
	}
	
}
